package com.hzm.controller;

import com.hzm.entity.Chapter;
import com.hzm.service.ChapterService;
import com.hzm.utils.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: qy137-java
 * @description:
 * @author: 皇子明
 * @create: 2021-10-23 09:17
 **/
@RestController
@RequestMapping("/order/chapter")
@Api(tags = "ChapterController")
public class ChapterController {
    @Autowired
    private ChapterService chapterService;
    @PostMapping("findChapterByCoursId/{courseId}")
    public Result findChapterByCoursId(@PathVariable String courseId){
        return chapterService.findChapterByCoursId(courseId);
    }
    @PostMapping("/findChapterById/{id}")
    public Result findChapterById(@PathVariable String id){
        return chapterService.findChapterById(id);

    }
    @PostMapping("/insertChapterWithCourseId")
    public Result insertChapter(@RequestBody Chapter chapter){
        return chapterService.insertChapter(chapter);

    }
    @PostMapping("/deleteChapterWithCourseId")
    public Result deleteChapterWithCourseId(@RequestBody Chapter chapter){
        return chapterService.deleteChapterWithCourseId(chapter);

    }
}














